1. Field of the Invention
The present invention relates to a method and an apparatus for performing a characterization with using an optical means and processing an image for recognition, and more particularly, to a technique for photographing a target to be photographed as image data of a plurality of gradations, extracting a target to be noted from the image and performing binarization.
2. Description of the Related Art
Conventionally, various methods for recognizing images have been suggested. The methods are executed for various purposes such as for searching an image for a specific pattern or for checking whether the target detected from the image has a normal shape. While the purposes are various, however, a method in which a target image is compared with a specific template image as a reference in some manner and the resultant is numerically evaluated, and thereby how much the target image matches the template image is checked is typically taken as the technique.
Hereinafter, a typical image recognition method which is very widespread will be described with reference to FIGS. 9 and 10. FIG. 9 illustrates an example of a process of a typical template matching in the image recognition method. In FIG. 9, a reference numeral 201 denotes a template image which is used for searching the target image 202 for a round image pattern indicated in the template image 201. Many round patterns as designated by the reference numerals 203 and 204 are present in the target image 202.
The template image 201 is 50 pixels high and 50 pixels wide. The target image 202 is 480 pixels high and 640 pixels wide, and each pixel has any of 256 gradations.
The target image 202 is sequentially searched, and thereby a round image pattern indicated in the template image is extracted from the target image 202. Initially, it is assumed that a frame of the same size as the template image 201 is positioned in a frame 205 in the upper left of the target image 202, and 50 pixels in height and 50 pixels in width are extracted from the target image 202.
Next, a process flow of the typical template matching shown in FIG. 9 will be described with reference to FIG. 10. In the process step 301, the template image 201 is superimposed on the portion 205 of the target image, and the pixels at the corresponding positions are subjected to difference operation for each pixel.
Next, in the process step S302, the resultants of the difference operations for the 50×50 pixels are individually squared, and then all the resultants of squaring are added. The value indicates correlation between both images, and the value is small when both images are the same while the value is large when both images are different from each other.
The comparator 304 compares the value 302 with a correlation threshold value 303, and when the obtained value is smaller than the correlation threshold value 303, it is judged that a specific pattern is detected while when the obtained value is larger than the correlation threshold value 303, it is judged that there is no specific pattern.
In FIG. 9, the judgement is made at the position of the partial image 205, and then the frame is one pixel displaced to the right in the image and the similar judgement is made, and this is repeated and thereby the judgements are sequentially made for the whole target image 202 in the order of the arrow 206. When the frame is positioned at 207, the template 201 matches the pattern 203, and the sum of the squares of the respective resultants 302 of the difference operation 301 is a very small value, and therefore it can be judged that a round pattern is present.
However, this method has a large problem. That is, the first problem is a problem of an amount of operation. In this example, since each judgement is made in units of 50 pixels, the subtraction, the square operation, and the addition are required to be performed 2500 times, 2500 times and 2499 times, respectively. Moreover, it is necessary to perform each of the above operations 590×430 times for the whole image. Accordingly, the amount of operation becomes very large and the time for the judgement becomes longer.
The second problem is a problem caused by a non-uniformity of a light. For example, in FIG. 9, the illumination on the target image 202 is non-uniform, and it is a little lighter on the right in the image. At this time, the pattern 204 and its adjacent background are also lighter, and when a difference from the template is obtained, the difference due to the non-uniformity of the brightness remains involved in all the pixels, and there is a possibility that the judgement is incorrectly made.
In order to solve the problems, for example, there is a suggestion disclosed in the Japanese Published Patent Application No. Hei.11-132959. It is disclosed therein that an adjacent actual image is used as a template, and a means for correcting brightness is provided so as to correct a luminance, and then a target image is compared with the template, thereby eliminating an influence due to the brightness.
The prior art image recognition method and image recognition apparatus are constructed as described above, in which while a processing for eliminating an influence due to non-uniformity of a light can be performed, the amount of operation cannot be reduced, and further an operation for correcting brightness is required, and thereby there is a problem that the processing load becomes more massive. Moreover, since an actual image is used as a template, the additions of the differences become larger due to an influence of a noise, thereby potentially leading to an incorrect judgement.